package com.wj.demo;



import java.io.File;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
//多文件上传
public class MultiUploadAciton extends ActionSupport {

	private List<File> upload;//上传文件的内容，由于是多个，用List集合
	private List<String> uploadFileName;//文件名
	public List<File> getUpload() {
		return upload;
	}
	public void setUpload(List<File> upload) {
		this.upload = upload;
	}
	public List<String> getUploadFileName() {
		return uploadFileName;
	}
	public void setUploadFileName(List<String> uploadFileName) {
		this.uploadFileName = uploadFileName;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		//return super.execute();
		String url="H:"+File.separator+"upload"+File.separator;
		if(upload!=null){
			for(int i=0;i<upload.size();i++){
				File saveFile=new File(url,getUploadFileName().get(i));
				//
				getUpload().get(i).renameTo(saveFile);
			}
		}
		return SUCCESS;
	}
	
	
}
